package service.impl;


import dao.UserDao;
import dao.impl.UserDaoImpl;
import model.User;
import service.UserService;
import java.sql.SQLException;
import java.util.List;


public class UserServiceImpl implements UserService {
    private UserDao userDao = new UserDaoImpl();
    private User user = new User();
    @Override
    public User findUserById(int id) throws SQLException {
        User user = userDao.findUserByUserId(id);
        return user;
    }

    @Override
    public boolean updateUser(User user) {
        boolean flag = false;
         flag = userDao.update(user);
        return flag;
    }

    @Override
    public User findUserByPhone(String phone) throws SQLException {
        User user = userDao.findUserByPhone(phone);
        return user;
    }
    @Override
    public boolean add(User user) {
        boolean flag = false;
        flag = userDao.add(user);
        return false;
    }

    @Override
    public List<User> findAllUser() {
        return userDao.findAll();
    }

    @Override
    public boolean delById(Integer id) {
        return false;
    }

    @Override
    public User findUserByEmail(String email) {
        User user = userDao.findUserByEmail(email);
        return user;
    }
}
